<!doctype html>
<html lang="en">
	<head>
		<title>Tween.js / easing with a power of number</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<style>
			body {
				margin: 0px;
			}

			#target {
				font-size: 13px;
				padding: 0px 32px;
			}
		</style>
		<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<div id="info" style="position: relative">
			<h1><a href="http://github.com/tweenjs/tween.js">tween.js</a></h1>
			<h2>17 _ Easing with Pow</h2>
			<p>TWEEN.Easing.generatePow() provides easing with a power of number.</p>
		</div>

		<div id="target"></div>

		<script type="module">
			import {createGraph} from './js/createGraph.js'
			import * as TWEEN from '../dist/tween.esm.js'

			const group = new TWEEN.Group()

			const target = document.getElementById('target')

			const addGraph = pow => {
				target.appendChild(createGraph(group, `Power"${pow}".In`, TWEEN.Easing.generatePow(pow).In))
				target.appendChild(createGraph(group, `Power"${pow}".Out`, TWEEN.Easing.generatePow(pow).Out))
				target.appendChild(createGraph(group, `Power"${pow}".InOut`, TWEEN.Easing.generatePow(pow).InOut))
			}
			target.appendChild(createGraph(group, 'Power1', TWEEN.Easing.generatePow(1).In))

			target.appendChild(document.createElement('br'))

			addGraph(2)
			addGraph(3)

			target.appendChild(document.createElement('br'))

			addGraph(4)
			addGraph(5)

			target.appendChild(document.createElement('br'))

			addGraph(5.8)
			target.appendChild(createGraph(group, `Exponential.In`, TWEEN.Easing.Exponential.In))
			target.appendChild(createGraph(group, `Exponential.Out`, TWEEN.Easing.Exponential.Out))
			target.appendChild(createGraph(group, `Exponential.InOut`, TWEEN.Easing.Exponential.InOut))

			animate()

			function animate(time) {
				requestAnimationFrame(animate)

				group.update(time)
			}
		</script>
	</body>
</html>
